home *** CD-ROM | disk | FTP | other *** search
- Path: news.netam.net!alpha!bgc
- From: bgc@alpha.netam.net (The Bowling Green Connection)
- Newsgroups: comp.lang.c
- Subject: HELP! Modifying the EOF in a file!
- Date: 13 Mar 1996 01:25:08 GMT
- Organization: NetAmerica, Bowling Green, KY.
- Message-ID: <4i585k$4ia@news.netam.net>
- NNTP-Posting-Host: alpha.netam.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- I am having trouble shortening the size of a text file...
- Suppose I have a text file with 3 lines of data, then I
- run this program:
-
- void main() {
- FILE *dat;
- dat=fopen("file.txt", "r+");
- fprintf(dat, "Hello! %c", EOF);
- fclose(dat);
- }
-
- Why doesn't the EOF character chop off the remaining two lines?
- When I print out the file after running this program, the ONLY thing
- that changed was the first few characters.. The other two lines
- still remain.. HELP!
-
- _______________________________________________________________________________
- Edgar E. Easterly, IV (bgc@bgcky.com) Bowling Green, Kentucky -=O=-
- "Except the Lord build thy house, ye labour in vain that build it; Except *
- the Lord keep thy city, the watchman will awake but in vain." Psalms 127:1 |
-